<template>
  <div id="printid" style="height: 600px; width: 100%; overflow: auto">
    <div v-html="content" id="content"></div>
  </div>

  <el-button type="primary" @click="go_print">打印</el-button>
</template>

<script>
import VolHeader from "@/components/basic/VolHeader.vue";
import http from "@/api/http.js";
import print from "print-js"; //使用文档：https://printjs.crabbly.com/
export default {
  components: { VolHeader, print },
  data() {
    return {
      content: "",
      imgurl: require("@/assets/imgs/comlog.png"), //注意图片的VUE端,资源文件是经过编译
    };
  },
  setup() {},
  destroyed() {},
  mounted() {
    /*   this.$nextTick(() => {
        console.log(this.$store.getters.data()._curr_muti_select);
        var reim_ids=new Array();
      this.$store.getters.data()._curr_muti_select.forEach(e => {
         reim_ids.push(e.reim_id);
      });
      var turl = "/api/customer/hktzs_print?_reimds="+reim_ids;
      this.http.post(turl, {}, true).then((s) => {
        this.content = s;
      });
    }); */
  },
  methods: {
    tj_search() {
      //console.log(this.$store.getters.data()._curr_muti_select);
      var reim_ids = new Array();
      this.$store.getters.data()._curr_muti_select.muti_select.forEach((e) => {
        reim_ids.push(e.reim_id);
      });
      let ls_type=this.$store.getters.data()._curr_muti_select.ls_type;
      var turl = "/api/customer/"+ls_type+"_print?_reimds_str=" + reim_ids;
      this.http.post(turl, {}, true).then((s) => {
        this.content = s;
      });
    },
    go_print() {
      //print.printJS('printJS-form', 'html')

      printJS({
        printable: "content",
        header: null,
        scanStyles: false,
        type: "html",
      });
    },
  },
};
</script>
<style scoped>
</style>